﻿using System;
using System.Collections.Generic;
using YXYLCommon;


namespace Entity
{
    
    /// <summary>
    /// 报表参数
    /// </summary>
    public class BaoBiaoMB: BaseModel
    {
        public BaoBiaoMB()
        {
            this.I_BAOBIAOID = DbInt.InitNull();
        }
        
        public DbInt I_BAOBIAOID { get; set; }

        public byte[] S_MUBAN { get; set; }

        public string S_CAOZUOR { get; set; }

        public DbDateTime D_CAOZUOSJ { get; set; }

        public override BaseModel ToObject(System.Data.DataRow row)
        {
            this.IsExists = true;
            this.I_BAOBIAOID = DbInt.Parse(row["I_BAOBIAOID"]);
            this.S_MUBAN = (byte[])(row["S_MUBAN"]);
            this.S_CAOZUOR = Convert.ToString(row["S_CAOZUOR"]);
            this.D_CAOZUOSJ = DbDateTime.Parse(row["D_CAOZUOSJ"]);
            return this;
        }
    }

    public class DALBaoBiaoMB:BaseDAL
    {
        public DALBaoBiaoMB()
        {
           
        }
        protected override void fillSaveProc(BaseModel model)
        {
            
        }

        //根据报表ID查询其模版
        public BaoBiaoMB GetByBaoBiaoId(int baobiaoid)
        {
            dbProc.Init("P_YSBBMB_GET");
            dbProc.AddParameter("V_I_BAOBIAOID", baobiaoid);
            dbProc.AddOracleCursor();
            return CommonService.Ini().GetObject<BaoBiaoMB>(dbProc);
        }    

        /// <summary>
        /// 保存
        /// </summary>
        public DbCmdResult Save(BaoBiaoMB obj)
        {
            dbProc.Init("P_YSBBMB_SAVE");
            dbProc.AddParameter("V_I_BAOBIAOID", obj.I_BAOBIAOID.DvalueDBParameter);
            dbProc.AddParameter("V_S_MUBAN", obj.S_MUBAN);
            dbProc.AddParameter("V_S_CAOZUOR", obj.S_CAOZUOR);
            dbProc.AddParameter("V_OPERATE", obj.Operate.ToString());
            return CommonService.Ini().ExcuteProcOracle(dbProc);
        }
    }
    
}